import java.net.InetAddress;

public class PingTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		InetAddress addr = InetAddress.getByName("www.r-learning.co.jp");
		long start = System.currentTimeMillis();
		boolean reachable = addr.isReachable(5000);
		long end   = System.currentTimeMillis();
		if (reachable) {
			System.out.println("到達: " + (end-start) + "ミリ秒");
		} else {
			System.out.println("不到達");
		}
	}
}
